package jfxtras.scene.control.test;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import jfxtras.scene.control.CalendarTextFieldX;


public class CalendarTextFieldXTest1 extends Application {
	
    public static void main(String[] args) {
    	//java.util.Locale.setDefault(new java.util.Locale("de")); // weeks starts on monday
    	jfxtras.application.Application.prelaunch();
        launch(args);       
    }

	@Override
	public void start(Stage stage) {

		// a layout
		VBox lVBox = new VBox();
        // add a node
		CalendarTextFieldX lCalendarTextFieldX = new CalendarTextFieldX();
		lCalendarTextFieldX.valueProperty().set(new GregorianCalendar(2011, 2, 01)); // set a value
		lVBox.getChildren().add(lCalendarTextFieldX);
        
		// button
		Button lButton = new Button("test");
		lVBox.getChildren().add(lButton);
		
        // create scene
        Scene scene = new Scene(lVBox, 300, 100);

        // create stage
        stage.setTitle("CalendarTextBoxX");
        stage.setScene(scene);
        stage.show();
    }
	
	/*
	 * 
	 */
	static protected String quickFormatCalendar(Calendar value)
	{
		SimpleDateFormat lSimpleDateFormat = (SimpleDateFormat)SimpleDateFormat.getDateInstance(SimpleDateFormat.LONG);
		lSimpleDateFormat.applyPattern("yyyy-MM-dd");
		return value == null ? "null" : lSimpleDateFormat.format(value.getTime());
	}

}
